package com.ape.mapsa.produccion.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * The persistent class for the formulas database table.
 * 
 */
@Entity
@Table(name = "formulas")
@NamedQuery(name = "Formula.findAll", query = "SELECT f FROM Formula f")
public class Formula implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	private String description;

	@Column(name = "forula_category")
	private String forulaCategory;

	// bi-directional many-to-one association to FormulaMp
	@OneToMany(mappedBy = "formula")
	private List<FormulaMp> formulaMps = new ArrayList<FormulaMp>();

	private Integer state;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modification_date")
	private Date modificationDate;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "creation_date")
	private Date creationDate;

	private String createdby;
	private String modifiedby;

	// bi-directional many-to-one association to OrdenProduccion
	@OneToMany(mappedBy = "formula")
	private List<OrdenProduccion> ordenProduccions;

	public Formula() {
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getForulaCategory() {
		return this.forulaCategory;
	}

	public void setForulaCategory(String forulaCategory) {
		this.forulaCategory = forulaCategory;
	}

	public List<FormulaMp> getFormulaMps() {
		return this.formulaMps;
	}

	public void setFormulaMps(List<FormulaMp> formulaMps) {
		this.formulaMps = formulaMps;
	}

	public FormulaMp addFormulaMp(FormulaMp formulaMp) {
		getFormulaMps().add(formulaMp);
		formulaMp.setFormula(this);

		return formulaMp;
	}

	public FormulaMp removeFormulaMp(FormulaMp formulaMp) {
		getFormulaMps().remove(formulaMp);
		formulaMp.setFormula(null);

		return formulaMp;
	}

	public List<OrdenProduccion> getOrdenProduccions() {
		return ordenProduccions;
	}

	public void setOrdenProduccions(List<OrdenProduccion> ordenProduccions) {
		this.ordenProduccions = ordenProduccions;
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public Date getModificationDate() {
		return modificationDate;
	}

	public void setModificationDate(Date modificationDate) {
		this.modificationDate = modificationDate;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public String getCreatedby() {
		return createdby;
	}

	public void setCreatedby(String createdby) {
		this.createdby = createdby;
	}

	public String getModifiedby() {
		return modifiedby;
	}

	public void setModifiedby(String modifiedby) {
		this.modifiedby = modifiedby;
	}

	@Override
	public String toString() {
		return description;
	}

}